package com.example.juc.big_talk_concurrent.chapter1.article5;

public class VolatileExample {
    int a = 0;
    volatile  boolean flag = false;

    public  void  writer(){
        a = 42;  // 1
        flag = true; // 2
    }

    public  void reader(){
        if(flag == true){ // 3
            int i = a; // 4

        }
    }
}
